import {Column, Entity, PrimaryGeneratedColumn} from 'typeorm';

@Entity()
export class Bookmark {
    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    category_id: number;

    @Column()
    user_id: number;

    @Column({type: 'varchar', name: 'title', default: ''})
    title: string;

    @Column({type: 'varchar', name: 'link', default: ''})
    link: string;

    @Column({type: 'varchar', name: 'desc', default: ''})
    desc: string;

    @Column()
    create_time: Date;

    @Column()
    updated_time: Date;

    //  点赞
    @Column()
    tags_num: string;

    // 收藏
    @Column()
    hoard_num: string;

    // 浏览
    @Column()
    pv: number;

    @Column({type: 'int', name: 'sort', default: 1})
    sort: number;
}

// 点赞/收藏
@Entity()
export class BookmarkTagsHoard {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({type: 'int', name: 'user_id', default: null})
    user_id: number;

    @Column({type: 'int', name: 'bookmark_id', default: null})
    bookmark_id: number;

    @Column({type: 'int', name: 'tags', default: 0})
    tags: number;

    @Column({type: 'int', name: 'hoard', default: 0})
    hoard: number;

    @Column()
    create_time: Date;

    @Column()
    updated_time: Date;
}
